package transforms;

import org.objectweb.asm.tree.FieldNode;

import com.rshacking.rhf.files.ClassContainer;
import com.rshacking.rhf.updater.Transform;
import com.rshacking.rhf.updater.hooks.HooksList;

public class ItemDefLoaderTransforms extends Transform {

    @Override
    public boolean canActivate(final HooksList hooks, final ClassContainer cc) {
        return hooks.contains("ItemDefLoader") && hooks.get("ItemDefLoader").getName().equals(cc.getName());
    }

    @Override
    public boolean execute(final HooksList hooks, final ClassContainer cc) {
        
        for (final FieldNode f : cc.getASM().fields) {
            if (f.desc.equals("Z")) {
                hooks.get("ItemDefLoader").add("members", f);
            }
                
        }
        
        return true;
    }

}
